<template>
  <div>
    <h3>管理员列表</h3>
    <el-table :data="managers" style="width: 100%; margin-top: 20px;">
      <el-table-column prop="username" label="用户名" width="180"></el-table-column>
      <el-table-column prop="phone" label="电话" width="180"></el-table-column>
      <el-table-column prop="lastLoginTime" label="上次登录时间" width="180"></el-table-column>
    </el-table>
  </div>
</template>

<script>
import axios from 'axios';

export default {
  data() {
    return {
      managers: []
    };
  },
  created() {
    this.fetchManagers();
  },
  methods: {
    fetchManagers() {
      axios.get('http://localhost:8081/api/auth/managers')
          .then(response => {
            this.managers = response.data;
          })
          .catch(error => {
            console.error("There was an error fetching the managers!", error);
          });
    }
  }
};
</script>
